package com.zbf.config;

/**
 * @author: LCG
 * 作者: LCG
 * 日期: 2021/3/23  13:53
 * 描述:
 */

import com.zbf.service.TestService00;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(MyGetProperties.class)
@ConditionalOnClass(TestService00.class)
public class MyAutoConfiguration {

    @Autowired
    private MyGetProperties myGetProperties;

    @ConditionalOnProperty(prefix = "com.lcg",name = "name",havingValue = "zhangsan")
    @Bean
    public TestService00 getTEstService00(){

        TestService00 testService00=new TestService00();
        testService00.setName(myGetProperties.getName());

        return testService00;
    }


}
